﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Edit.ascx.vb" Inherits="Control_Announcement_Edit" %>
<%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
<script type="text/javascript">


    function ConvertText() {
        txtTitle = document.getElementById("<%= txtTitle.ClientID %>");
        var str = txtTitle.value.trim();
        txtTitle.value = str.substring(0, 1) + str.substring(1, str.length).toLowerCase();
        return false;
    }


    function ajaxJquery() {

        $(function () {
            $(".ItemDisabled").attr("disabled", "true");


            //Upload Image
            $('#file_upload').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/Upload.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': false,
                'fileExt': '*.*',
                'fileDesc': 'Files',
                'fileDataName': 'myfile',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    $('#<%=hidImagePath.ClientID %>').val('<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response);

                }
            });



            var str = "";
            //Upload Album 
            $('#file_upload_content').uploadify({
                'uploader': '<%=ResolveUrl("~/uploadify/uploadify.swf")%>',
                'script': '<%=ResolveUrl("~/uploadify/UploadAlbum.ashx?folder=ImageStorage")%>',
                'cancelImg': '<%=ResolveUrl("~/uploadify/cancel.png")%>',
                'folder': '<%=ResolveUrl("~/Uploads")%>',
                'auto': false,
                'multi': true,
                'fileExt': '*.jpg;*.gif;*.png;*.jpeg;*.bmp',
                'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG , .JPEG , .BMP)',
                'fileDataName': 'fileAlbum',
                'sizeLimit': '<%= ConfigurationManager.AppSettings("maxupload") %>',
                'onComplete': function (event, ID, fileObj, response, data) {
                    str += '<%= ConfigurationManager.AppSettings("ImageDomain") %>' + response;
                },
                'onAllComplete': function (event, data) {
                    str += "0";
                    var myAlbum = new Array();
                    myAlbum = str.split(",");
                    str = "";
                    for (var i = 0; i < myAlbum.length - 1; i++) {
                        $("#<%= txtContent.ClientID %>").find('iframe').contents().find('body').append("<p align='center'><img alt=''  src='" + myAlbum[i] + "' /></p><p  align='center'>Mô tả ảnh</p>");
                    }
                }
            });
        });
    }
    
</script>
<asp:UpdatePanel ID="UpdatePanelThongBao" runat="server">
    <ContentTemplate>
        <div class="content_porletform">
            <div class="HeadTitle">
                <h3>
                    CHỈNH SỬA THÔNG BÁO</h3>
            </div>
            <div class="box_contentform">
                <div class="box_scroll_grid">
                    <div class="BoxField">
                        <div class="DivRow">
                            <div class="DivRequired">
                                <span class="fieldRequired">&nbsp;</span>Trường yêu cầu nhập dữ liệu
                            </div>
                            <div class="Error">
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="#FF3300" />
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="lblTitle" CssClass="Tiêu đề" runat="server" Text="Tiêu đề:" /><span
                                    class="fieldRequired">&nbsp;</span>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                                    Display="None" ErrorMessage=" Vui lòng nhập tiêu đề bản tin."></asp:RequiredFieldValidator>
                            </div>
                            <div class="DivTextBox">
                                <asp:TextBox ID="txtTitle" CssClass="TextBox" runat="server" Text="" Width="460px" />
                                <asp:LinkButton ID="lnkConvertText" Text="convert text" CausesValidation="false"
                                    OnClientClick="return ConvertText();" runat="server"></asp:LinkButton>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="lblDescription" CssClass="TextLabel" runat="server" Text="Mô tả:" />
                                <span class="fieldRequired">&nbsp;</span>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtDescription"
                                    Display="None" ErrorMessage="Vui lòng nhập mô tả bản tin."></asp:RequiredFieldValidator>
                            </div>
                            <div class="DivTextBox">
                                <asp:TextBox ID="txtDescription" CssClass="TextBox" runat="server" Text="" Width="460px"
                                    Height="100px" Rows="5" TextMode="MultiLine" />
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label3" CssClass="TextLabel" runat="server" Text="Ảnh nội dung:" />
                            </div>
                            <div class="DivTextBox">
                                <input id="file_upload_content" name="file_upload_content" type="file" />
                                <a id="uploadupd" href="javascript:$('#file_upload_content').uploadifyUpload();">Upload
                                    Files</a>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="lblContent" CssClass="TextLabel" runat="server" Text="Nội dung:" />
                            </div>
                            <div class="DivTextBox">
                                <CE:Editor ID="txtContent" runat="server" Width="100%" Height="500" EditorWysiwygModeCss="~/example.css">
                                    <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                        CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                                </CE:Editor>
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                <asp:Label ID="Label1" CssClass="TextLabel" runat="server" Text="File đính kèm:" />
                            </div>
                            <div class="DivTextBox" style="padding-left: 20px">
                                <input id="file_upload" name="file_upload" type="file" /><a id="upload" href="javascript:$('#file_upload').uploadifyUpload();">Upload
                                    Files</a><br />
                                <b>Hoặc:</b><br />
                                <asp:TextBox ID="hidImagePath" Text="" runat="server" CssClass="TextBox" />
                            </div>
                        </div>
                        <div class="DivRow" style="padding-top: 5px;">
                            <div class="DivLabel">
                                <asp:Label ID="Label5" CssClass="TextLabel" runat="server" Text="Thông báo quan trọng:" />
                                <asp:CheckBox ID="chkIsNew" runat="server" />
                            </div>
                        </div>
                        <div class="DivRow">
                            <div class="DivLabel">
                                &nbsp;&nbsp;&nbsp;</div>
                            <div class="DivTextBox">
                                <asp:Button ID="btnSave" runat="server" Text=" Lưu " CssClass="btn" />
                                &nbsp;<asp:Button ID="btnHuy" CausesValidation="false" runat="server" Text=" Hủy "
                                    CssClass="btn" />
                            </div>
                        </div>
                    </div>
                    <div style="display: none">
                        <asp:HiddenField ID="hidID" Value="0" runat="server" />
                        <asp:HiddenField ID="hidType" Value="0" runat="server" />
                        <asp:TextBox ID="txtKeyword" CssClass="TextBox" Text="" runat="server" Visible="true"></asp:TextBox>
                        <asp:TextBox ID="txtStrKeyWord" CssClass="TextBox" Text="" runat="server" Visible="true"></asp:TextBox>
                        <asp:TextBox ID="txtSubjectId" CssClass="TextBox" Text="0" runat="server"></asp:TextBox>
                        <asp:TextBox ID="hidImageBig" Text="" runat="server" />
                    </div>
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
